package top.kpromise.note.modules.user.entity;

import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import top.kpromise.common.base.BaseEntity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;

@Data
@EqualsAndHashCode(callSuper = false)
@Entity(name = "user")
@org.hibernate.annotations.Table(appliesTo = "user", comment = "用户表")
@Table(name = "user")
@DynamicInsert
@DynamicUpdate
public class UserEntity extends BaseEntity implements Serializable {

	private static final long serialVersionUID = 1588677189685L;
	
	@ApiModelProperty(name = "nickName", value = "用户昵称")
	@Column(columnDefinition = "VARCHAR(32) comment '用户昵称'")
	private String nickName;

	@ApiModelProperty(name = "password", value = "用户密码")
	@Column(columnDefinition = "VARCHAR(128) comment '用户密码'")
	@JsonIgnore
	private String password;

	@ApiModelProperty(name = "userName", value = "用户名-登录用")
	@Column(columnDefinition = "VARCHAR(32) comment '用户名-登录用'")
	private String userName;

	@ApiModelProperty(name = "userState", value = "用户状态，0-正常、1-锁定、9-注销")
	@Column(columnDefinition = "TINYINT default 0 comment '用户状态，0-正常、1-锁定、9-注销'")
	private Integer userState;
}